{include file="header.html"}
<div id="rightTop">
    <p>{$lang.stat}</p>
    {include file=subnav.html}
</div>
<div class="mrightTop">
    <div class="fontl">
        <form method="get">
            <div class="left">
                <input type="hidden" name="app" value="stat_member" />
                <input type="hidden" name="act" value="scale" />
                <div class="left">
                    <select name="search_type" id="search_type" class="querySelect">
                        <option value="day" <!--{if $search_arr.search_type eq 'day'}-->selected<!--{/if}-->>{$lang.stat_by_day}</option>
                        <option value="week" <!--{if $search_arr.search_type eq 'week'}-->selected<!--{/if}-->>{$lang.stat_by_week}</option>
                        <option value="month" <!--{if $search_arr.search_type eq 'month'}-->selected<!--{/if}-->>{$lang.stat_by_month}</option>
                    </select>
                </div>
                <div id="searchtype_day" style="display:none;" class="left">
                    <input class="txt date" type="text" value="{$search_arr.day.search_time|date:Y-m-d}" id="search_time" name="search_time">
                </div>
                <div id="searchtype_week" style="display:none;" class="left">
                    <select name="searchweek_year" class="querySelect">
                        <!--{foreach from=$year_arr item=v key=k}-->
                        <option value="{$k}" <!--{if $search_arr.week.current_year eq $k}-->selected<!--{/if}-->>{$v}</option>
                        <!--{/foreach}-->
                    </select>
                    <select name="searchweek_month" class="querySelect">
                        <!--{foreach from=$month_arr item=v key=k}-->
                        <option value="{$k}" <!--{if $search_arr.week.current_month eq $k}-->selected<!--{/if}-->>{$v}</option>
                        <!--{/foreach}-->
                    </select>
                    <select name="searchweek_week" class="querySelect">
                        <!--{foreach from=$week_arr item=v key=k}-->
                        <option value="{$v.key}" <!--{if $search_arr.week.current_week eq $v.key}-->selected<!--{/if}-->>{$v.val}</option>
                        <!--{/foreach}-->
                    </select>
                </div>

                <div id="searchtype_month" style="display:none;" class="left">
                    <select name="searchmonth_year" class="querySelect">
                        <!--{foreach from=$year_arr item=v key=k}-->
                        <option value="{$k}" <!--{if $search_arr.month.current_year eq $k}-->selected<!--{/if}-->>{$v}</option>
                        <!--{/foreach}-->
                    </select>
                    <select name="searchmonth_month" class="querySelect">
                        <!--{foreach from=$month_arr item=v key=k}-->
                        <option value="{$k}" <!--{if $search_arr.month.current_month eq $k}-->selected<!--{/if}-->>{$v}</option>
                        <!--{/foreach}-->
                    </select>
                </div>
                <input type="submit" class="formbtn" value="{$lang.query}" />
                <input type="hidden" id="export_type" name="export_type" data-param='{"url":"{$actionurl}&exporttype=excel"}' value="excel"/>
                <a class="btn1" href="javascript:void(0);" id="export_btn"><span>导出Excel</span></a>
            </div>
        </form>
    </div>
</div>
<div class="tdare">
    <table width="100%" cellspacing="0" class="dataTable">
        <thead>
            <tr class="tatr1">
                <td class="firstCell">{$lang.member_name}</td>
                <td>{$lang.inc_prepaid_deposit}</td>
                <td>{$lang.desc_prepaid_deposit}</td>
            </tr>
        </thead>
        <tbody id="datatable">
            <!--{if $statlist}-->
            <!--{foreach from=$statlist item=v key=k name=name}-->
            <tr class="tatr2">
                <td class="firstCell">{$v.user_name|escape}</td>
                <td>{$v.predincrease|escape}</td>
                <td>{$v.predreduce|escape}</td>
            </tr>
            <!--{/foreach}-->
            <!--{else}-->
            <tr class="no_data">
                <td colspan="3">{$lang.no_data}</td>
            </tr>
            <!--{/if}-->
        </tbody>
    </table>
    <div class="pageLinks">{include file=page.bottom.html}</div>
</div>
<script>
    $(function() {
        //统计数据类型
        var s_type = $("#search_type").val();
        $('#search_time').datepicker({dateFormat: 'yy-mm-dd'});

        show_searchtime();
        $("#search_type").change(function() {
            show_searchtime();
        });
        //展示搜索时间框
        function show_searchtime() {
            s_type = $("#search_type").val();
            $("[id^='searchtype_']").hide();
            $("#searchtype_" + s_type).show();
        }

        //更新周数组
        $("[name='searchweek_month']").change(function() {
            var year = $("[name='searchweek_year']").val();
            var month = $("[name='searchweek_month']").val();
            $("[name='searchweek_week']").html('');
            $.getJSON('index.php?app=stat_member&act=getweekofmonth', {y: year, m: month}, function(data) {
                if (data != null) {
                    for (var i = 0; i < data.length; i++) {
                        $("[name='searchweek_week']").append('<option value="' + data[i].key + '">' + data[i].val + '</option>');
                    }
                }
            });
        });

        $('#container').highcharts({$stat_json});

        //导出图表
        $("#export_btn").click(function() {
            var item = $("#export_type");
            var type = $(item).val();
            if (type == 'excel') {
                download_excel(item);
            }
        });

    });

</script>


{include file="footer.html"}